import request from '@/utils/request';

// 根据桌号提交菜品列表
export function addDishList(data) {
  return request({
    url: '/project/cart/addDishList',
    method: 'post',
    data: data
  });
}
//根据桌号查询购物车
export function selectAllByTableId(tableId) {
  return request({
    url: '/project/cart/listByTableId?tableId=' + tableId,
    method: 'get',

  })
}
// 查询购物车列表
export function listCart(query) {
  return request({
    url: '/project/cart/list',
    method: 'get',
    params: query
  });
}

// 查询购物车详细
export function getCart(cartId) {
  return request({
    url: '/project/cart/' + cartId,
    method: 'get'
  });
}

// 新增购物车
export function addCart(data) {
  return request({
    url: '/project/cart',
    method: 'post',
    data: data
  });
}

// 修改购物车
export function updateCart(data) {
  return request({
    url: '/project/cart',
    method: 'put',
    data: data
  });
}


// 根据桌号删除购物车中的特定菜品
export function deleteCartByTableId(tableId) {
  return request({
    url: `/project/cart/deleteByTableId/${tableId}`,
    method: 'delete'
  });
}

// 删除购物车
export function delCart(cartId) {
  return request({
    url: '/project/cart/' + cartId,
    method: 'delete'
  })
}

//添加订单
export function addToOrder(data) {
  return request({
    url: '/order/addOrder',
    method: 'post',
    data: data
  });
}
//添加订单
export function insertOrder(orderData) {
  return request({
    url: '/project/cart/settleAccounts',
    method: 'post',
    data: orderData
  });
}

//insertCustomerMessage插入用户信息
export function insertCustomerMessage(data) {
  return request({
    url: '/customer/insert',
    method: 'post',
    data: data
  })
}

//插入数据到customer_table
export function insertCustomerTableMessage(tableId) {
  return request({
    url: '/customer/insertT?tableId=' + tableId,
    method: 'post',
  })
}

//getUId获取uid
export function getUId(query) {
  return request({
    url: '/customer/getUId',
    method: 'get',
    params: query
  });
}
